//
//  MainPage.m
//  Project_Demo
//
//  Created by caoxiaozhu on 2018/6/29.
//  Copyright © 2018年 caoxiaozhu. All rights reserved.
//

#import "MainPage.h"
#import "AppDelegate.h"

@interface MainPage ()<appdelegateDelegate>

@property(nonatomic,strong)NSArray *titleArr;

@end

@implementation MainPage

//-(NSArray *)titleArr{
//    if (_titleArr) {
//        _titleArr = [NSArray arrayWithObjects:@"你好",@"我好",@"他好", nil];
//    }
//    return _titleArr;
//}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if (![[NSUserDefaults standardUserDefaults] boolForKey:BOOLFORKEY]) {
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:BOOLFORKEY];
        // 静态引导页
        //        [self setStaticGuidePage];
        
        // 动态引导页
        [self setDynamicGuidePage];
        
        // 视频引导页
        //         [self setVideoGuidePage];
    }
    
    self.title = @"首页";
    
    Fir_TableViewController *fir_TableView =[[Fir_TableViewController alloc]init];
    CGFloat startY = 0;
    if (CurrentSystemVersion > 10) {
//        startY = naviHeight;
    }
    
    fir_TableView.tableView.frame = CGRectMake(0, startY, kScreenWidth, kScreenHeight);
    [self addChildViewController:fir_TableView];
    [self.view addSubview:fir_TableView.tableView];
}

#pragma mark - 设置APP静态图片引导页
- (void)setStaticGuidePage {
    NSArray *imageNameArray = @[@"guideImage1.jpg",@"guideImage2.jpg",@"guideImage3.jpg",@"guideImage4.jpg",@"guideImage5.jpg"];
    DHGuidePageHUD *guidePage = [[DHGuidePageHUD alloc] dh_initWithFrame:self.view.frame imageNameArray:imageNameArray buttonIsHidden:NO];
    guidePage.slideInto = YES;
    [self.navigationController.view addSubview:guidePage];
}

#pragma mark - 设置APP动态图片引导页
- (void)setDynamicGuidePage {
    NSArray *imageNameArray = @[@"guideImage6.gif",@"guideImage7.gif",@"guideImage8.gif"];
    DHGuidePageHUD *guidePage = [[DHGuidePageHUD alloc] dh_initWithFrame:self.view.frame imageNameArray:imageNameArray buttonIsHidden:NO];
    guidePage.slideInto = NO;
    [self.navigationController.view addSubview:guidePage];
}

#pragma mark - 设置APP视频引导页
- (void)setVideoGuidePage {
    NSURL *videoURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"guideMovie1" ofType:@"mov"]];
    DHGuidePageHUD *guidePage = [[DHGuidePageHUD alloc] dh_initWithFrame:self.view.bounds videoURL:videoURL];
    [self.navigationController.view addSubview:guidePage];
}

@end
